import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
       // 求2个整数的最大公约数
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int max = Math.max(a, b);
        int min = Math.min(a, b);
        while(max % min != 0){
            int temp = max % min;
            max = min;
            min = temp;
        }
        if(min == 1){
            System.out.println("互质");
        }
        else{
            System.out.println(min);
        }
    }
}